

void UI_DlgInsert::setInsert(PF_Insert& i) {
    insert = &i;
    //pen = insert->getPen();
    wPen->setPen(insert->getPen(false), true, false, "Pen");
    PF_Graphic* graphic = insert->getGraphic();
    if (graphic!=NULL) {
        cbLayer->init(*(graphic->getLayerList()), false, false);
    }
    PF_Layer* lay = insert->getLayer(false);
    if (lay!=NULL) {
        cbLayer->setLayer(*lay);
    }
    QString s;
    s.setNum(insert->getInsertionPoint().x);
    leInsertionPointX->setText(s);
    s.setNum(insert->getInsertionPoint().y);
    leInsertionPointY->setText(s);
    s.setNum(insert->getScale().x);
    leScale->setText(s);
    s.setNum(PF_Math::rad2deg(insert->getAngle()));
    leAngle->setText(s);
    s.setNum(insert->getRows());
    leRows->setText(s);
    s.setNum(insert->getCols());
    leCols->setText(s);
    s.setNum(insert->getSpacing().x);
    leRowSpacing->setText(s);
    s.setNum(insert->getSpacing().y);
    leColSpacing->setText(s);
}

void UI_DlgInsert::updateInsert() {
    insert->setInsertionPoint(PF_Vector(PF_Math::eval(leInsertionPointX->text()),
                                  PF_Math::eval(leInsertionPointY->text())));
    insert->setScale(PF_Vector(PF_Math::eval(leScale->text()), 
                                PF_Math::eval(leScale->text())));
    insert->setAngle(PF_Math::deg2rad(PF_Math::eval(leAngle->text())));
    insert->setRows(PF_Math::round(PF_Math::eval(leRows->text())));
    insert->setCols(PF_Math::round(PF_Math::eval(leCols->text())));
    insert->setSpacing(PF_Vector(PF_Math::eval(leRowSpacing->text()),
                                 PF_Math::eval(leColSpacing->text())));
    insert->setPen(wPen->getPen());
    insert->setLayer(cbLayer->currentText());
}

